package com.jwsoft.manager.core.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jwsoft.manager.core.dao.model.EduAddressTree;
import com.jwsoft.manager.core.dao.model.EduAddressTreeSchool;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 地址树与学校关联表 Mapper 接口
 * </p>
 *
 * @author fangs
 * @since 2023-02-24
 */
@Mapper
public interface EduAddressTreeSchoolMapper extends BaseMapper<EduAddressTreeSchool> {

    @Override
    int deleteById(Serializable id);

    @Override
    int deleteById(EduAddressTreeSchool entity);

    @Override
    int deleteByMap(Map<String, Object> columnMap);

    @Override
    int delete(Wrapper<EduAddressTreeSchool> queryWrapper);

    @Override
    int deleteBatchIds(Collection<?> idList);


    int removeSchoolRelation(@Param("ids") List<Long> ids, @Param("treeId") Long treeId);

    List<EduAddressTree> querySchoolRelationTownBySchId(@Param("orgId") String orgId);

    /**
     * 查询统计某学校在某一节点集合绑定的节点数和叶子节点数
     *
     * @param treeIds  地址树节点id集合
     * @param schoolId 学校id
     * @return boundNextNum : 绑定的节点数 ， boundLeafNum : 绑定的叶子节点数
     * @author fangs
     */
    EduAddressTreeSchool queryBoundSchoolNum(List<Long> treeIds, String schoolId);
}
